package com.qccx.ueuo.selfguide.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 日期和字符串转换工具类
 * @author Administrator
 *
 */
public class DateUtils 
{
	private static SimpleDateFormat sdf = null;
	
	public static String date2String(Date date)
	{
		String dateString = null;
		if(sdf==null)
		{
			sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		}
		dateString = sdf.format(date);
		return dateString;
	}
	
	public static Date string2Date(String dateString)
	{
		
		Date date = null;
		if(sdf==null)
		{
			sdf = new SimpleDateFormat();
		}
		try {
			date = sdf.parse(dateString);
		} catch (ParseException e) {
			e.printStackTrace();
		}
		return date;
	}
}
